﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ArtMath
{
    public abstract class clsFormulaBase
    {
        public PictureBox picturebox;
        PointD location;
        SizeD size;
        bool edit = true, showline = false;
        public clsFormulaBase(PictureBox pb)
        {
            picturebox = pb;
        }
        public bool Edit
        {
            get { return edit; }
            set
            {
                edit = value;
                picturebox.Invalidate();
            }
        }
        public PointD Location
        {
            get { return location; }
            set
            {
                location = value;
                setChildLocation();
                picturebox.Invalidate();
            }
        }
        public SizeD Size
        {
            get { return size; }
            set
            {
                size = value;
                setChildLocation();
                picturebox.Invalidate();
            }
        }
        public double Right
        {
            get { return location.X + size.Width; }
        }
        public double Bottom
        {
            get { return location.Y + size.Height; }
        }
        public virtual void setChildLocation()
        {

        }
        public virtual void Paint(Graphics gra)
        {
            if (edit)
            {
                Pen p = new Pen(Color.DarkGray, 2);
                p.DashStyle = DashStyle.Dot;
                gra.SmoothingMode = SmoothingMode.HighSpeed;
                gra.DrawRectangle(p, (float)location.X, (float)location.Y, (float)size.Width, (float)size.Height);
                gra.SmoothingMode = SmoothingMode.HighQuality;
                //if (showline) gra.DrawLine(new Pen(Color.Black, 1), region.Left + 4, region.Top + 4, region.Left + 4, region.Bottom - 4);
            }
        }
    }
}
